package com.huawei.appgallery.common.media.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
import o.ble.b;
import o.ble.g;
import o.ble.i;
import o.ble.j;
import o.blg;
import o.bli;
import o.blj;
import o.blj.c;
import o.bln;

public class GroupAdapter extends BaseAdapter {
    private Context context;
    private bli iLoadImageListener;
    private List<blg> imageGroupList;
    private LayoutInflater inflater = null;
    private String mediaType;

    static class a {
        private ImageView ˊ;
        private ImageView ˋ;
        private ImageView ˎ;
        private TextView ˏ;
        private TextView ॱ;

        private a() {
        }
    }

    public int getCount() {
        if (this.imageGroupList == null) {
            return 0;
        }
        return this.imageGroupList.size();
    }

    public Object getItem(int i) {
        if (this.imageGroupList == null) {
            return null;
        }
        return this.imageGroupList.get(i);
    }

    public long getItemId(int i) {
        return (long) i;
    }

    public GroupAdapter(Context context, String str) {
        this.context = context;
        this.mediaType = str;
        this.inflater = LayoutInflater.from(context);
        this.imageGroupList = bln.ˊ().ॱ();
    }

    public void setILoadImageListener(bli o_bli) {
        this.iLoadImageListener = o_bli;
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        a aVar;
        if (view == null) {
            aVar = new a();
            view = this.inflater.inflate(j.ʻ, null);
            aVar.ˎ = (ImageView) view.findViewById(b.ˋॱ);
            aVar.ˋ = (ImageView) view.findViewById(b.ॱˊ);
            aVar.ˊ = (ImageView) view.findViewById(b.ॱᐝ);
            aVar.ॱ = (TextView) view.findViewById(b.ʻॱ);
            aVar.ˏ = (TextView) view.findViewById(b.ॱˎ);
            view.setTag(aVar);
        } else {
            aVar = (a) view.getTag();
        }
        final blg o_blg = (blg) this.imageGroupList.get(i);
        CharSequence ˊ = o_blg.ˊ();
        if ("all_medias".equals(ˊ)) {
            ˊ = this.context.getString(g.ˎ);
        }
        aVar.ॱ.setText(ˊ);
        int i2 = i.ॱ;
        aVar.ˏ.setText(this.context.getResources().getQuantityString(i2, o_blg.ˏ(), new Object[]{Integer.valueOf(o_blg.ˏ())}));
        view.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ GroupAdapter ˎ;

            public void onClick(View view) {
                this.ˎ.iLoadImageListener.ˏ(o_blg.ˊ());
            }
        });
        c cVar = new c();
        cVar.ˋ(o_blg.ॱ());
        cVar.ॱ(true);
        cVar.ˎ(this.mediaType);
        cVar.ˎ(288);
        cVar.ˊ(288);
        cVar.ˏ(o_blg.ˋ());
        blj.ˋ().ॱ(this.context, aVar.ˎ, cVar);
        blj.ˋ().ॱ(this.context, aVar.ˋ, cVar);
        blj.ˋ().ॱ(this.context, aVar.ˊ, cVar);
        return view;
    }
}
